<template>
  <div>
    <div class="header">
      <van-nav-bar
        title="全部订单"
        left-text="返回首页"
        left-arrow
        @click-left="$router.push('/home')"
      >
        <template #left>
          <van-icon name="arrow-left" size="25" color="black" />
        </template>
        <template #right> </template>
      </van-nav-bar>
    </div>
    <div class="main">
      <div class="nothing" v-if="empty">
        <van-empty
          class="custom-image"
          image="https://img01.yzcdn.cn/vant/custom-empty-image.png"
          description="暂无订单"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getOrdList } from "./../../api/detail";
export default {
  data() {
    return {
      empty: true,
      Oridlist: [],
    };
  },
  created() {
    //判断用户是id
    if (localStorage.getItem("userid")) {
      //发送获取订单请求
      getOrdList({ userid: localStorage.getItem("userid") }).then((res) => {
        if (res.data.code == "10001") {
          //没有数据
          this.empty = true;
        } else {
          //有数据
          this.empty = false;
          this.Oridlist = res.data.data;
          console.log(this.Oridlist);
        }
      });
    }
  },
};
</script>

<style>
</style>